package com.itqf.service.impl;

import com.itqf.mapper.DtsOrderMapper;
import com.itqf.service.DtsOrderService;
import com.itqf.vo.CategorySellAmts;
import com.itqf.vo.DayStatis;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * projectName: shop_manage
 *
 * @author: MaTianWei
 * time: 2021/7/14 17:18
 * description:
 */
@Service
public class DtsOrderServiceImpl implements DtsOrderService {

    public static final Logger logger = LoggerFactory.getLogger(DtsOrderServiceImpl.class);

    @Autowired
    private DtsOrderMapper dtsOrderMapper;

    //查询指定时间内，类别的消瘦额
    @Override
    public List<CategorySellAmts> queryOrderSell(int days) {

        if(days <= 0 ){

            logger.error("[类别销售额]不能查询时间小于0的类别销售额度");

            return null;
        }


        List<CategorySellAmts> categorySellAmts = dtsOrderMapper.queryCategorySell(days);

        logger.info("[类别销售额]业务查询成功，数据为：{}",categorySellAmts);

        return categorySellAmts;
    }


    //查询天数内的订单消瘦额
    @Override
    public List<DayStatis> queryDayOrderCell(int days) {

        if(days <= 0 ){

            logger.error("[类别销售额]不能查询表时间小于0的类别销售额度");

            return null;
        }

        List<DayStatis> dayStatis =  dtsOrderMapper.queryDaySell(days);

        logger.info("[日常销售]每日销售统计数据为：{}",dayStatis);
        return dayStatis;
    }
}
